package top.chenfu.mq;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: romantic_ke@163.com
 * @Description: 发布消息
 * @Date: 2019/8/11 20:48
 */
@Component
public class SenderMsg {

    @Autowired
    private AmqpTemplate amqpTemplate;

    /**
     * 发送消息
     *
     * @param msg
     */
    public void send(String msg) {
        System.out.println("sender:" + msg);
        this.amqpTemplate.convertAndSend("hello-queue",msg);
    }

}
